#ifndef _MAIN_H_
#define _MAIN_H_

#include <vector>
#include <string>
#include <deque>
#include <utility>
#include <iostream>
#include <GL/glut.h>
#include <GL/gl.h>

#include "snake.h"

// typedef std::vector<std::vector<char>> mat_char;
using mat_char = std::vector<std::vector<char>>;

extern mat_char tmap;
extern std::vector<bool> key_states;
extern bool is_play;
extern bool is_play_init;
extern bool is_over;
extern const int t_size;

extern int speed_time;
extern int score;

class Snake {
public:
  int length = 4;
  int head_x = t_size * 10 + 12;
  int head_y = t_size * 10 + 12;

  int direction_x = 1;
  int direction_y = 0;

  std::deque<std::pair<int, int>> deq;

  Snake();
  ~Snake();
  void init_draw();
  void auto_move();
  void detect_eat_food();
  void crash(std::vector<std::vector<char>> tmap);
};

extern Snake tsnake;

#endif